<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
<html:html>
<head>
<html:base />
<title><bean:message key="Application.Name"/></title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link href="css/formas.css" rel="stylesheet" type="text/css">
<link href="css/calendar.css" rel="stylesheet" type="text/css">
<style type="text/css">
#div_cal {
	background-color:#FF9933;
	position:absolute;
}
</style>
<script LANGUAGE="JavaScript" type="text/javascript" src="js/AnchorPosition.js"></script>
<script LANGUAGE="JavaScript" type="text/javascript" src="js/PopupWindow.js"></script>
<script LANGUAGE="JavaScript" type="text/javascript" src="js/date.js"></script>
<script LANGUAGE="JavaScript" type="text/javascript" src="js/CalendarPopup.js"></script>
<script language="javascript" type="text/javascript" src="js/util.js"></script>
<script language="javascript" type="text/javascript">
	function fnc_validarForma(forma){
		var bol_retVal = true;
		var str_errores = "";
		
		if(Trim(forma.titulo.value)==""){
			str_errores += " - <bean:message key='StudyPlan.content.Bibliography.tile'/> <bean:message key='errors.required'/>\n";
		}
		if(Trim(forma.autor.value)==""){
			str_errores += " - <bean:message key='StudyPlan.content.Bibliography.author'/> <bean:message key='errors.required'/>\n";
		}
		if(Trim(forma.editorial.value)==""){
			str_errores += " - <bean:message key='StudyPlan.content.Bibliography.editorial'/> <bean:message key='errors.required'/>\n";
		}
		if(Trim(forma.anio.value)==""){
			str_errores += " - <bean:message key='StudyPlan.content.Bibliography.year'/> <bean:message key='errors.required'/>\n";
		}
		if(!esNumero(forma.anio.value,0)){
			str_errores += " - <bean:message key='StudyPlan.content.Bibliography.year'/> <bean:message key='errors.integer'/>\n";
		}
		if(Trim(forma.pais.value)==""){
			str_errores += " - <bean:message key='StudyPlan.content.Bibliography.country'/> <bean:message key='errors.required'/>\n";
		}
		if(Trim(forma.edicion.value)==""){
			str_errores += " - <bean:message key='StudyPlan.content.Bibliography.edition'/> <bean:message key='errors.required'/>\n";
		}
		if( Trim(forma.isbn.value) == "" ){
			str_errores += " - <bean:message key='StudyPlan.content.Bibliography.isbn'/> <bean:message key='errors.required'/>\n";
		}
		if( forma.tipo.selectedIndex == 0 ){
			str_errores += " - <bean:message key='StudyPlan.content.Bibliography.type'/> <bean:message key='errors.required'/>\n";
		}
		if( str_errores != "" ){
			bol_retVal = false;
			alert( " <bean:message key='Application.Error(s)'/> : \n" + str_errores );
		}
		return bol_retVal;
	}
	function fnc_closeReview(){
		if( '<bean:write name="ses_usuario" property="per_planes"/>' == '1'   ){
			var forma = document.forms[0];
			forma.titulo.disabled = true;
			forma.autor.disabled = true;
			forma.editorial.disabled = true;
			forma.anio.disabled = true;
			forma.pais.disabled = true;
			forma.edicion.disabled = true;
			forma.edicion.disabled = true;
			forma.isbn.disabled = true;
			forma.tipo.disabled = true;
			forma.btn_aceptar.disabled = true;
		}
	}
	<logic:present name="req_msg">
		alert("<bean:write name='req_msg'/>");
	</logic:present>
</script>
</head>
<body onload="fnc_closeReview();">
	<table cellpadding="0" cellspacing="0" class="formas">
    	<tr>
        	<td>
		   	<table cellpadding="0" cellspacing="0" class="barraNavegacion">
       			<tr>
       			<td><html:link action="/academy_welcome?action=selectAcademy" styleClass="barraNavegacion"><img src="images/icn_liga.gif" border="0"><bean:message key="AcademyWelcome.Init"/></html:link>
			        		<html:link action="/academy_list" styleClass="barraNavegacion"><img src="images/icn_liga.gif" border="0"><bean:message key="Menu.AcademyHeader"/></html:link>
			        		<html:link action="/subject_list" styleClass="barraNavegacion" name="academia" property="map_id"><img src="images/icn_liga.gif" border="0"><bean:message key="StudyPlan.subjects"/></html:link>
			        		<html:link action="/contents_list" styleClass="barraNavegacion" name="materia" property="map_id"><img src="images/icn_liga.gif" border="0"><bean:message key="StudyPlan.subjects.contents"/></html:link>
			        		<html:link  action="/bibliography_list" styleClass="barraNavegacion" name="materia" property="map_id" ><img src="images/icn_liga.gif" border="0"><bean:message key="StudyPlan.content.BibliografiaTile"/></html:link>
		        </td>
		    </table>
		  	<table cellpadding="0" cellspacing="0" class="titulo">
	        	<tr>
	            	<td class="iconos_imgs"><a href="mailto:<bean:message key="Application.mailto"/>"><img src="images/icn_correo.gif" width="18" height="18" border="0"></a></td>
	               	<td class="txt_titulo"><bean:message key="StudyPlan.content.BibliografiaTile"/></td>
		      	</tr>
          	</table>
 <html:form action="/bibliography_save" onsubmit="return fnc_validarForma(this);">
 					<html:hidden property="id"/>
	            	<input type="hidden" name="subject_id" value="<bean:write name="materia" property="codigo"/>"/>
	            	<input type="hidden" name="academy_id" value="<bean:write name="academia" property="codigo"/>"/>
			<table cellpadding="0" cellspacing="2" class="info_formas">
        		<tr> 
          			<td class="formas-txtInfo"><bean:message key="StudyPlan.content.BibliografiaTexto"/></td>
        		</tr>
        		<table cellpadding="0" cellspacing="2" class="info_titulo">
        			<tr> 
						<td class="formas-encabezado"><bean:message key="StudyPlan.subject.subjectData"/></td>
					</tr>
           			<tr> 
						<td>						
							<table cellpadding="0" cellspacing="2" class="info_titulo">
								<tr> 
									<td class=""><strong><bean:message key="StudyPlan.subject"/></strong></td>
									<td class=""><bean:write name="materia" property="codigo"/> - <bean:write name="materia" property="nombre"/></td>
								</tr>
								<tr> 
									<td class=""><strong><bean:message key="AcademyWelcome.Academy"/></strong></td>
									<td class=""><bean:write name="academia" property="codigo"/> - <bean:write name="academia" property="nombre"/></td>
								</tr>						
		            		</table>
	          			<td> 
					</tr>
					<tr> 
						<td class="formas-encabezado"><bean:message key="StudyPlan.content.bookData"/></td>
					</tr>
					<tr> 
						<td colspan="3" align="center">
							<table cellpadding="0" cellspacing="2" class="info_titulo">
								<tr> 
									<td class="" ><bean:message key="StudyPlan.content.Bibliography.tile"/></td>
									<td class="" colspan="5">
										<html:text property="titulo" size="50"/>
									</td>
								</tr>
								<tr> 
									<td class=""><bean:message key="StudyPlan.content.Bibliography.author"/></td>
									<td class="" colspan="5">
										<html:text property="autor" size="55"/>							
									</td>
								</tr>
								<tr>
									<td class=""><bean:message key="StudyPlan.content.Bibliography.editorial"/></td>
									<td colspan="5" class="">
										<html:text property="editorial" size="55" />
									</td>
								</tr>
								<tr>
									<td><bean:message key="StudyPlan.content.Bibliography.year"/></td>
									<td><html:text property="anio" size="8"  maxlength="8"/></td>
									<td><bean:message key="StudyPlan.content.Bibliography.country"/></td>
									<td><html:text property="pais" size="20" /></td>
									<td><bean:message key="StudyPlan.content.Bibliography.edition"/></td>
									<td><html:text property="edicion" size="8" /></td>
								</tr>
								<tr>
									<td class=""><bean:message key="StudyPlan.content.Bibliography.isbn"/></td>
									<td class="" colspan="3">
										<html:text property="isbn" size="20" />
									</td>
									<td colspan="1">
										<bean:message key="StudyPlan.content.Bibliography.type"/>
									</td>
									<td>
										<html:select property="tipo">
												<html:option value=""><bean:message key="StudyPlan.content.Bibliography.selectType"></bean:message></html:option>
												<html:options collection="tipos" property="codigo" labelProperty="descripcion"/>
											</html:select>
									</td>

								</tr>
								<tr> 
									<td colspan="6" align="center">
										<div align="center">
											<html:submit property="btn_aceptar"><bean:message key="Application.Accept" /></html:submit>
											<input type="button" onclick="location.href='<html:rewrite action="/bibliography_list" name="materia" property="map_id"/>';" value="<bean:message key='Application.Cancel'/>"/>
										</div>
									</td>
								</tr>
							</table>
						</td>
					</tr>
		      	</table>
		  	</td>
    	</tr>
  	</table>  
 </html:form>
</body>
</html:html>
